package cn.java79.quiz.dao;

import cn.java79.quiz.entity.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public interface UserMapper {
    //登录
    public User login(@Param("loginname") String loginname,@Param("password")String password);
    //查找全部用户
    List<User> search(@Param("loginname") String loginname, @Param("realname")String realname, @Param("phone")String phone);

    int checkEmail(String email);
    //type 分别为email,phone和loginname
    int checkRepeat(@Param("type")String type,@Param("value")String value);

    public int save(User u);

    int del(long id);

    public User get(long id);

    int update(User user);
    //扣积分
    int decrScore(@Param("id")long id,@Param("score")int score);

    int resetPass(@Param("mail")String mail, @Param("newpass")String newpass);
}
